#ifndef __WIZ_ARCHIVE_READER_INTERFACE_HPP__SHANHAOBO_19800429__
#define __WIZ_ARCHIVE_READER_INTERFACE_HPP__SHANHAOBO_19800429__

#include "./WizArchiveForwardDeclare.hpp"

namespace Wiz
{
    namespace Archive
    {
        namespace Reader
        {
            template<class DerivedT>
            struct Interface
            {
                typedef ::Wiz::TypeTraits::Bool::True       IsReading;
                typedef ::Wiz::TypeTraits::Bool::False      IsWriting;

            protected:
                Interface(){};

            protected:
                typedef DerivedT    tDerived;
                typedef tDerived&   tDerivedRef;
                typedef tDerived*   tDerivedPtr;

                tDerivedPtr DerivedPtr()
                {
                    return ::Wiz::Cast::Static<tDerivedPtr>(this);
                }

                tDerivedRef DerivedRef()
                {
                    return *(::Wiz::Cast::Static<tDerivedPtr>(this));
                }

            public:
                template<class T>
                tDerivedRef operator>>(T & t)
                {
                    DerivedRef().ReadOverride(t, 0);
                    return DerivedRef();
                }

                // the & operator 
                template<class T>
                tDerivedRef operator&(T & t)
                {
                    return (DerivedRef() >> t);
                }
            };
        } /// end of namespace Reader
    } /// end of namespace Archive
} /// end of namespace Wiz

#endif /*__WIZ_ARCHIVE_READER_INTERFACE_HPP__SHANHAOBO_19800429__*/
